// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
import App from './App'
import router from './router'
import axios from 'axios'
// import "./utils/rem"
Vue.prototype.$axios = axios
axios.interceptors.request.use((config) => {
	config.headers.Authorization = localStorage.getItem('token');;
	return config;
});
// axios.interceptors.response.use((config) => {
// 	if(config.data.code == 455){
// 		ElementUI.Message({
// 			  message: config.data.msg,
// 			  type: 'error'
// 			});
// 		return ;
// 	}
// 	if( config.data.code > 450 &&  config.data.code<460 ){
// 		ElementUI.Message({
// 			  message: config.data.msg,
// 			  type: 'error'
// 			});
// 	    window.localStorage.clear();
// 		router.push("/login");
// 	}
// 	return config;
// });

// router.beforeEach((to,from,next)=>{
// 	if(to.path == "/login"){
// 		return next();
// 	}
// 	const Authorization = window.localStorage.getItem("token");
// 	//本地获取token，如果没有就返回登录页面
// 	if(Authorization==null || Authorization == undefined){
// 		return next('/login');
// 	}
// 	next();
// });


// Vue.config.productionTip = false
import api from './api' // 导入api接口

Vue.prototype.$api = api; // 将api挂载到vue的原型上复制代码
// Vue.prototype.HOST='/api'
// axios.defaults.baseURL = '/server';

// axios.defaults.baseURL = 'http://192.168.0.126:6061';
axios.defaults.baseURL = 'http://122.112.213.124:6061';

// axios.defaults.baseURL = 'http://127.0.0.1:6061';


// // axios.defaults.headers.common['Authorization'] = AUTH_TOKEN;

// axios.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded';


// import './utils/flexible'

Vue.use(ElementUI);

Vue.config.productionTip = false

/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  components: { App },
  template: '<App/>'
})



  
 